import request from './request'

// 获取成绩列表
export function getGradeList(params) {
    return request({
        url: '/grade/list',
        method: 'get',
        params
    })
}

// 获取成绩详情
export function getGradeDetail(id) {
    return request({
        url: `/grade/detail/${id}`,
        method: 'get'
    })
}

// 添加成绩
export function addGrade(data) {
    return request({
        url: '/grade/add',
        method: 'post',
        data
    })
}

// 更新成绩信息
export function updateGrade(id, data) {
    return request({
        url: `/grade/update/${id}`,
        method: 'put',
        data
    })
}

// 删除成绩
export function deleteGrade(id) {
    return request({
        url: `/grade/delete/${id}`,
        method: 'delete'
    })
}

// 批量删除成绩
export function batchDeleteGrade(ids) {
    return request({
        url: '/grade/batch-delete',
        method: 'delete',
        data: { ids }
    })
}

// 批量导入成绩
export function batchImportGrades(data) {
    return request({
        url: '/grade/batch-import',
        method: 'post',
        data
    })
}

// 获取学生列表
export function getStudentList() {
    return request({
        url: '/student/simple-list',
        method: 'get'
    })
}

// 获取课程列表
export function getCourseList() {
    return request({
        url: '/course/simple-list',
        method: 'get'
    })
}

// 获取班级列表
export function getClassList() {
    return request({
        url: '/class/simple-list',
        method: 'get'
    })
}

// 获取学期列表
export function getSemesterList() {
    return request({
        url: '/semester/list',
        method: 'get'
    })
}

// 获取成绩统计信息
export function getGradeStatistics(params) {
    return request({
        url: '/grade/statistics',
        method: 'get',
        params
    })
}

// 导出成绩
export function exportGrades(params) {
    return request({
        url: '/grade/export',
        method: 'get',
        params,
        responseType: 'blob'
    })
}